#include<iostream>
#include<pthread.h>
#include<unistd.h>


using namespace std;

void* mythread(void* args)
{
    while(true)
    {
        cout << "new thread,pid: " << getpid() << endl;
        sleep(2);
    }
}


int main()
{
    pthread_t tid;
    pthread_create(&tid,nullptr,mythread,nullptr);

    while(true)
    {
        cout << "main thread,pid: " << getpid() << endl;
        sleep(1);
    }
    return 0;
}